import { pageHandler } from '@/mixins/pageHandler'
import resizeMap from "@/mixins/resizeMap";
import ScaleBox from '@/components/ScaleBox/ScaleBox.vue'
import {rectList} from "@/views/singlePhaseMeter/data.js";

export default {
	name: 'singlePhaseMeter',
	components: {
		ScaleBox,
	},
	mixins: [pageHandler, resizeMap],
	data() {
		return {
			rectList,
			formData: {
				number: '',
				studentName: '',
				unit: '',
				forward: { sharp: '1', peak: '2', flat: '3', valley: '4', total: '5' },
				reverse: { sharp: '6', peak: '7', flat: '8', valley: '9', total: '10' },
				voltage: '11',
				current: '22',
				userName: '张三',
				userNo: '001',
				FYResult: '结果1',
				FYremark: '备注1',
				YXQResult: '结果2',
				YXQremark: '备注2',
				SZResult: '结果3',
				SZremark: '备注3',
				SDResult: '结果4',
				SDremark: '备注4',
				DJResult: '/',
				DJremark: '备注5',
				energyMeterName: '电能表名称',
				energyMeterModel: '电能表型号',
				energyMeterType: '电能表规格',
				energyMeterManufacturer: '电能表厂家',
				serialNum: '出厂编号',
				accuracyClass: '精度等级',
				accuracyClass: '精度等级',
				currentElectricityPrice: '/'
			},
			// 点击按钮翻页
			currentPage: 1, // 当前页码
			totalPages: ''  ,// 总页数
			currentShowItemObj: null,
			pageListData: [
				{
					currentPage: 1,
					dataObj: {
						type: '电压',
						phaseName: 'B',
						voltageB: "0.0",
						voltageAUnit: "V",
						quadrant: '1',
						name: '电压',
						Ua: true,
						Ub: false,
						Uc: true,
						Ia: true,
						Ib: false,
						Ic: true,
						value1: '02010200',
						value2: '00',
					}
				},
				{
					currentPage: 2,
					dataObj: {
						voltageC: "100.9",
						voltageAUnit: "V",
						quadrant: '1',
						name: '电压',
						Ua: true,
						Ub: false,
						Uc: true,
						Ia: true,
						Ib: false,
						Ic: true,
						value1: '02010300',
						value2: '00',
					}
				}
			],
			
		}
	},
	created() {
		// 默认显示第一页数据
		this.currentShowItemObj = this.pageListData.filter(item => item.currentPage == this.currentPage)[0]
		this.totalPages = this.pageListData.length
	},
	methods: {
		handleAreaClick(event) {
			if (event.target.tagName === "AREA") {
				event.preventDefault();
				event.stopPropagation();
				if(event.target.dataset.name == '切换'){
					if (this.currentPage < this.totalPages) {
						this.currentPage++;
					} else {
						this.currentPage = 1; // 回到第一页
					}
					this.currentShowItemObj = this.pageListData.filter(item => item.currentPage == this.currentPage)[0]
				}
			}
		},
		initData(e) {
			this.filterData(e)
		},
		filterData(data) {
			
		}
	},
	mounted() {},
	destroyed() {

	},
	watch: {

	}
}